# Miscellaneous graphics functions and libraries # 14 April 2013 # NJG par.default <- par(no.readonly=TRUE) Ant.Data <- read.csv("antcountydata.csv", header=TRUE) attach(Ant.Data) ############################################################## # Add formatted text to a plot library(gplots) par(mfrow=c(1,2)) plot(lat.centroid,n.species) reg.model <- lm(n.species~lat.centroid) abline(reg.model) textplot(capture.output(summary(reg.model))) par(par.default) ############################################################## # Add a boxed label to a plot library(plotrix) plot(lat.centroid,n.species) # give x, y positions boxed.labels(45.5,75,"boxed.labels",bg="gray90",cex=2) ############################################################### # Add a text box to a plot library(plotrix) #give c(xmin,xmax), y top; # lines determined by amount of text textbox(c(45.5,46.5),80,"this is a text box on several lines") ############################################################### # stack the labels if they are too crowded library(plotrix) par(mar=c(8,4,4,2)) plot(lat.centroid,n.species,axes=FALSE) axis(1,labels=FALSE) axis(2) box() my.labs <-round(seq(41,47,by=0.25),3) staxlab(1,at=my.labs) #add srt=45 to rotate ################################################################ # add an axis break library(plotrix) plot(lat.centroid,n.species) axis.break(1)